local PartnerSkillPanel = app.mvc.createPanelClass(...)
local PartnerSkillRender = import(".renders.PartnerSkillRender")
local ListViewVertical = require("app.widget.listview.ListViewVertical")
--data =
function PartnerSkillPanel.createWithData(data, node)
    assert(node ~= nil, "PartnerSkillPanel node is nil")
    local sprite = PartnerSkillPanel.extend(node)
    if node == nil then
        ccui.Helper:doLayout(sprite)
    end
    sprite:init(data)
    return sprite
end

function PartnerSkillPanel.create(node)
    return PartnerSkillPanel.createWithData(nil, node)
end

function PartnerSkillPanel:init(data)
    self.super.init(self, data)
    self._skills = {}

    local params = {
        renderClass = PartnerSkillRender,
        perNum = 1,
        cellEventProxy = function(eventName, data)

        end,
    }
    self._ui.ScrollView:setVisible(true)
    self._productListnode = ListViewVertical.new( self._ui.ScrollView, params )

    --[[
    for i =1, 4 do
        local e = PartnerSkillRender.create(self._ui["skill_"..i])
        self._skills[i] = e
        e:setIndex(i)
    end
    --]]
end

-- function PartnerSkillPanel:onRenderCallback()

-- end
function PartnerSkillPanel:refresh()
    if not self._data then
        return
    end
    self._skillsData = self._data:getSkills()
    self._productListnode:reloadData(self._skillsData)
--[[
    for i =1, 4 do
        local e = self._skills[i]
        local eData = self._skillsData[i]
        if eData then
            e:setData(eData)
            e:setVisible(true)
        else
            e:setVisible(false)
        end
    end
    --]]
end

return PartnerSkillPanel